Optimal. Leaf size=158 \[ -\frac {c^4 (A+6 i B) \tan (e+f x)}{a^2 f}+\frac {4 c^4 (3 A+5 i B)}{a^2 f (-\tan (e+f x)+i)}-\frac {4 c^4 (-B+i A)}{a^2 f (-\tan (e+f x)+i)^2}+\frac {6 c^4 (-3 B+i A) \log (\cos (e+f x))}{a^2 f}+\frac {6 c^4 x (A+3 i B)}{a^2}-\frac {B c^4 \tan ^2(e+f x)}{2 a^2 f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.21, antiderivative size = 158, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 41, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.049, Rules used = {3588, 77} \[ -\frac {c^4 (A+6 i B) \tan (e+f x)}{a^2 f}+\frac {4 c^4 (3 A+5 i B)}{a^2 f (-\tan (e+f x)+i)}-\frac {4 c^4 (-B+i A)}{a^2 f (-\tan (e+f x)+i)^2}+\frac {6 c^4 (-3 B+i A) \log (\cos (e+f x))}{a^2 f}+\frac {6 c^4 x (A+3 i B)}{a^2}-\frac {B c^4 \tan ^2(e+f x)}{2 a^2 f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 77
Rule 3588
Rubi steps
\begin {align*} \int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^4}{(a+i a \tan (e+f x))^2} \, dx &=\frac {(a c) \operatorname {Subst}\left (\int \frac {(A+B x) (c-i c x)^3}{(a+i a x)^3} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a c) \operatorname {Subst}\left (\int \left (-\frac {(A+6 i B) c^3}{a^3}-\frac {B c^3 x}{a^3}+\frac {8 i (A+i B) c^3}{a^3 (-i+x)^3}+\frac {4 (3 A+5 i B) c^3}{a^3 (-i+x)^2}+\frac {6 (-i A+3 B) c^3}{a^3 (-i+x)}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {6 (A+3 i B) c^4 x}{a^2}+\frac {6 (i A-3 B) c^4 \log (\cos (e+f x))}{a^2 f}-\frac {4 (i A-B) c^4}{a^2 f (i-\tan (e+f x))^2}+\frac {4 (3 A+5 i B) c^4}{a^2 f (i-\tan (e+f x))}-\frac {(A+6 i B) c^4 \tan (e+f x)}{a^2 f}-\frac {B c^4 \tan ^2(e+f x)}{2 a^2 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 9.36, size = 1079, normalized size = 6.83 \[ c^4 \left (\frac {\left (-\frac {1}{2} B \cos (2 e)-\frac {1}{2} i B \sin (2 e)\right ) (\cos (f x)+i \sin (f x))^2 (A+B \tan (e+f x)) \sec ^3(e+f x)}{f (A \cos (e+f x)+B \sin (e+f x)) (i \tan (e+f x) a+a)^2}+\frac {\sec (e) (\cos (f x)+i \sin (f x))^2 \left (-\frac {1}{2} i A \cos (2 e-f x)+3 B \cos (2 e-f x)+\frac {1}{2} i A \cos (2 e+f x)-3 B \cos (2 e+f x)+\frac {1}{2} A \sin (2 e-f x)+3 i B \sin (2 e-f x)-\frac {1}{2} A \sin (2 e+f x)-3 i B \sin (2 e+f x)\right ) (A+B \tan (e+f x)) \sec ^2(e+f x)}{f (A \cos (e+f x)+B \sin (e+f x)) (i \tan (e+f x) a+a)^2}+\frac {x (\cos (f x)+i \sin (f x))^2 (-6 i \tan (e) A-6 A-18 i B+18 B \tan (e)+(3 B-i A) (6 \cos (2 e)+6 i \sin (2 e)) \tan (e)) (A+B \tan (e+f x)) \sec (e+f x)}{(A \cos (e+f x)+B \sin (e+f x)) (i \tan (e+f x) a+a)^2}+\frac {4 (2 B-i A) \cos (2 f x) (\cos (f x)+i \sin (f x))^2 (A+B \tan (e+f x)) \sec (e+f x)}{f (A \cos (e+f x)+B \sin (e+f x)) (i \tan (e+f x) a+a)^2}+\frac {(A \cos (e)+3 i B \cos (e)+i A \sin (e)-3 B \sin (e)) \left (6 \tan ^{-1}(\tan (f x)) \cos (e)+6 i \tan ^{-1}(\tan (f x)) \sin (e)\right ) (\cos (f x)+i \sin (f x))^2 (A+B \tan (e+f x)) \sec (e+f x)}{f (A \cos (e+f x)+B \sin (e+f x)) (i \tan (e+f x) a+a)^2}+\frac {(A \cos (e)+3 i B \cos (e)+i A \sin (e)-3 B \sin (e)) \left (3 i \cos (e) \log \left (\cos ^2(e+f x)\right )-3 \log \left (\cos ^2(e+f x)\right ) \sin (e)\right ) (\cos (f x)+i \sin (f x))^2 (A+B \tan (e+f x)) \sec (e+f x)}{f (A \cos (e+f x)+B \sin (e+f x)) (i \tan (e+f x) a+a)^2}+\frac {(A+i B) \cos (4 f x) (i \cos (2 e)+\sin (2 e)) (\cos (f x)+i \sin (f x))^2 (A+B \tan (e+f x)) \sec (e+f x)}{f (A \cos (e+f x)+B \sin (e+f x)) (i \tan (e+f x) a+a)^2}+\frac {(A+3 i B) (6 f x \cos (2 e)+6 i f x \sin (2 e)) (\cos (f x)+i \sin (f x))^2 (A+B \tan (e+f x)) \sec (e+f x)}{f (A \cos (e+f x)+B \sin (e+f x)) (i \tan (e+f x) a+a)^2}-\frac {4 (A+2 i B) (\cos (f x)+i \sin (f x))^2 \sin (2 f x) (A+B \tan (e+f x)) \sec (e+f x)}{f (A \cos (e+f x)+B \sin (e+f x)) (i \tan (e+f x) a+a)^2}+\frac {(A+i B) (\cos (2 e)-i \sin (2 e)) (\cos (f x)+i \sin (f x))^2 \sin (4 f x) (A+B \tan (e+f x)) \sec (e+f x)}{f (A \cos (e+f x)+B \sin (e+f x)) (i \tan (e+f x) a+a)^2}\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.96, size = 242, normalized size = 1.53 \[ \frac {12 \, {\left (A + 3 i \, B\right )} c^{4} f x e^{\left (8 i \, f x + 8 i \, e\right )} + {\left (-2 i \, A + 6 \, B\right )} c^{4} e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (i \, A - B\right )} c^{4} + {\left (24 \, {\left (A + 3 i \, B\right )} c^{4} f x + {\left (-6 i \, A + 18 \, B\right )} c^{4}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + {\left (12 \, {\left (A + 3 i \, B\right )} c^{4} f x + {\left (-9 i \, A + 27 \, B\right )} c^{4}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left ({\left (6 i \, A - 18 \, B\right )} c^{4} e^{\left (8 i \, f x + 8 i \, e\right )} + {\left (12 i \, A - 36 \, B\right )} c^{4} e^{\left (6 i \, f x + 6 i \, e\right )} + {\left (6 i \, A - 18 \, B\right )} c^{4} e^{\left (4 i \, f x + 4 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{a^{2} f e^{\left (8 i \, f x + 8 i \, e\right )} + 2 \, a^{2} f e^{\left (6 i \, f x + 6 i \, e\right )} + a^{2} f e^{\left (4 i \, f x + 4 i \, e\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 2.87, size = 443, normalized size = 2.80 \[ -\frac {\frac {2 \, {\left (-3 i \, A c^{4} + 9 \, B c^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{a^{2}} - \frac {2 \, {\left (-6 i \, A c^{4} + 18 \, B c^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}{a^{2}} - \frac {2 \, {\left (3 i \, A c^{4} - 9 \, B c^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{a^{2}} + \frac {9 i \, A c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} - 27 \, B c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} - 2 \, A c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 12 i \, B c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 18 i \, A c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 56 \, B c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 \, A c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 12 i \, B c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 9 i \, A c^{4} - 27 \, B c^{4}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 1\right )}^{2} a^{2}} + \frac {-25 i \, A c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} + 75 \, B c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} - 108 \, A c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 324 i \, B c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 182 i \, A c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 514 \, B c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 108 \, A c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 324 i \, B c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 25 i \, A c^{4} + 75 \, B c^{4}}{a^{2} {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}^{4}}}{f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.23, size = 198, normalized size = 1.25 \[ -\frac {B \,c^{4} \left (\tan ^{2}\left (f x +e \right )\right )}{2 a^{2} f}-\frac {c^{4} A \tan \left (f x +e \right )}{f \,a^{2}}-\frac {6 i c^{4} B \tan \left (f x +e \right )}{f \,a^{2}}-\frac {20 i c^{4} B}{f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}-\frac {12 c^{4} A}{f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}-\frac {4 i c^{4} A}{f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}+\frac {4 c^{4} B}{f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {6 i c^{4} A \ln \left (\tan \left (f x +e \right )-i\right )}{f \,a^{2}}+\frac {18 c^{4} B \ln \left (\tan \left (f x +e \right )-i\right )}{f \,a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 8.77, size = 207, normalized size = 1.31 \[ -\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (-\frac {18\,B\,c^4}{a^2}+\frac {A\,c^4\,6{}\mathrm {i}}{a^2}\right )}{f}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {c^4\,\left (A+B\,3{}\mathrm {i}\right )}{a^2}+\frac {B\,c^4\,3{}\mathrm {i}}{a^2}\right )}{f}-\frac {\frac {\left (-6\,B\,c^4+A\,c^4\,2{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,a^2}-\frac {\left (-18\,B\,c^4+A\,c^4\,6{}\mathrm {i}\right )\,3{}\mathrm {i}}{2\,a^2}+\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {2\,\left (-18\,B\,c^4+A\,c^4\,6{}\mathrm {i}\right )}{a^2}+\frac {16\,B\,c^4}{a^2}\right )-\frac {B\,c^4\,8{}\mathrm {i}}{a^2}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )}-\frac {B\,c^4\,{\mathrm {tan}\left (e+f\,x\right )}^2}{2\,a^2\,f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 1.31, size = 382, normalized size = 2.42 \[ \frac {2 i A c^{4} - 12 B c^{4} + \left (2 i A c^{4} e^{2 i e} - 10 B c^{4} e^{2 i e}\right ) e^{2 i f x}}{- a^{2} f e^{4 i e} e^{4 i f x} - 2 a^{2} f e^{2 i e} e^{2 i f x} - a^{2} f} + \begin {cases} \frac {\left (\left (i A a^{2} c^{4} f e^{2 i e} - B a^{2} c^{4} f e^{2 i e}\right ) e^{- 4 i f x} + \left (- 4 i A a^{2} c^{4} f e^{4 i e} + 8 B a^{2} c^{4} f e^{4 i e}\right ) e^{- 2 i f x}\right ) e^{- 6 i e}}{a^{4} f^{2}} & \text {for}\: a^{4} f^{2} e^{6 i e} \neq 0 \\x \left (- \frac {12 A c^{4} + 36 i B c^{4}}{a^{2}} + \frac {i \left (- 12 i A c^{4} e^{4 i e} + 8 i A c^{4} e^{2 i e} - 4 i A c^{4} + 36 B c^{4} e^{4 i e} - 16 B c^{4} e^{2 i e} + 4 B c^{4}\right ) e^{- 4 i e}}{a^{2}}\right ) & \text {otherwise} \end {cases} + \frac {6 i c^{4} \left (A + 3 i B\right ) \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a^{2} f} - \frac {x \left (- 12 A c^{4} - 36 i B c^{4}\right )}{a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________